var querDetialUrl = "../loan/findById.action";
var querClUrl = "../loanFiles/findByType.action";
var oldLoanInfo;
var subBusinessType;

/*-------------------------页面加載------------------------------*/
var loadsoftDetInfo = function(data) {
	util.emmAjax({
		url : querDetialUrl,
		type : 'post',
		data : {
			'loanId' : data
		},
		cache : false,
		dataType : 'text',
		success : function(data) {
			var obj = util.str2Json(data); 
			if(obj.success=='true')
				{
				var object = util.str2Json(data).data.loanInfo;
				subBusinessType=util.str2Json(data).data.subBusinessType;
				$("#borrowerName").html(object.borrowerName);
				$("#spouseName").html(object.spouseName);
				var sexDesc;
				if(object.sex=="1")
				{
					sexDesc="男";
				}
				else if(object.sex=="2")
				{
					sexDesc="女";
				}
				else {
					sexDesc=object.sex;
				}
				$("#sex").html(sexDesc);
			    $("#credentialNo").html(object.credentialNo);
			    $("#isMaryed").html(object.isMaryed);
			    if(object.isMaryed=="是")
			    {
			    	$("#spouseInfo").show();
			    	 $("#spouseName").html(object.spouseName);
			    	 $("#spouseCredentialNo").html(object.spouseCredentialNo);
			    }
			    else if(object.isMaryed=="否")
			    {
			    	$("#spouseInfo").hide();
			    }
			    var businessTypeDesc;
			    var remark1Desc="";
			    var remark2Desc="";
			    if(object.businessTypes=="1")
				{
			    	businessTypeDesc="一手房贷款";
			    	if(object.ysfRemark1=='1')
		    		{
			    		remark1Desc="一手住房贷款";
			    		remark2Desc=object.yszfRemark2;
		    		}
			    	else if(object.ysfRemark1=='2')
		    		{
			    		remark1Desc="商用房贷款";
			    		if(object.syfRemark2=="1")
		    			{
			    			remark2Desc="车位";
			    			//备注2位车位时不显示第几套房信息
			    			$("#houseNumNameTd").hide();
							$("#houseNumValueTd").hide();
		    			}
			    		else if (object.syfRemark2=="2")
		    			{
			    			remark2Desc="商铺、写字楼";
		    			}
		    		}
			    	else if(object.ysfRemark1=='3')
		    		{
			    		remark1Desc="职工或职工配偶贷款";
			    		$("#remark2Td").hide();
						$("#remark2Val").hide();
		    		}
			    	else
		    		{
			    		remark1Desc=object.syfRemark1;
			    		$("#remark2Td").hide();
						$("#remark2Val").hide();
		    		}
			    	$("#areaAndAmount").show();
					$("#numAndIncome").show();
					
					$("#payPerMon").show();
					//为表中的可编辑项填值
					$("#addArea").val(object.area);
					$("#addHouseAmount").val(object.houseAmount);
					$("#addHouseNum").val(object.houseNum);
					$("#addIncome").val(object.income);
					$("#addPayPerMonth").val(object.payPerMonth);
				}
				else if(object.businessTypes=="2")
				{
					businessTypeDesc="二手房贷款";
					//remark1Desc="";
					if(object.esfRemark=='1')
		    		{
			    		remark1Desc="尊园地产推荐";
		    		}
			    	else if(object.esfRemark=='2')
		    		{
			    		remark1Desc="其他中介推荐";
		    		}
			    	else if(object.esfRemark=='3')
		    		{
			    		remark1Desc="职工或职工配偶贷款";
		    		}
			    	else
		    		{
			    		remark1Desc=object.esfRemark;
		    		}
					$("#remark2Td").hide();
					$("#remark2Val").hide();
					$("#areaAndAmount").show();
					$("#numAndIncome").show();
					$("#payPerMon").show();
					//为表中的可编辑项填值
					$("#addArea").val(object.area);
					$("#addHouseAmount").val(object.houseAmount);
					$("#addHouseNum").val(object.houseNum);
					$("#addIncome").val(object.income);
					$("#addPayPerMonth").val(object.payPerMonth);
					
				}else if(object.businessTypes=="3")
				{
					businessTypeDesc="个人消费贷款";
					if(object.xfdkRemark=='1')
		    		{
			    		remark1Desc="个人消费贷款";
		    		}
			    	else if(object.xfdkRemark=='2')
		    		{
			    		remark1Desc="公职人员个人消费贷款";
		    		}
			    	else if(object.xfdkRemark=='3')
		    		{
			    		remark1Desc="公喜贷";
		    		}
			    	else if(object.xfdkRemark=='4')
		    		{
			    		remark1Desc="职工或职工配偶贷款";
		    		}
			    	else
		    		{
			    		remark1Desc=object.xfdkRemark;
		    		}
					$("#remark2Td").hide();
					$("#remark2Val").hide();
				}else if(object.businessTypes=="4")
				{
					businessTypeDesc="个人经营性贷款";
					if(object.jydkRemark1=='1')
		    		{
			    		remark1Desc="个人经营性贷款";
			    		$("#remark2Td").hide();
						$("#remark2Val").hide();
		    		}
			    	else if(object.jydkRemark1=='2')
		    		{
			    		remark1Desc="失业人员小额担保贷款";
			    		remark2Desc=object.syryRemark2;
		    		}
			    	else if(object.jydkRemark1=='3')
		    		{
			    		remark1Desc="“贷免扶补”创业小额贷款";
			    		remark2Desc=object.dmfbRemark2;
		    		}
			    	else if(object.jydkRemark1=='4')
		    		{
			    		remark1Desc="红色信贷";
			    		$("#remark2Td").hide();
						$("#remark2Val").hide();
		    		}
			    	else
		    		{
			    		remark1Desc=object.jydkRemark1;
			    		$("#remark2Td").hide();
						$("#remark2Val").hide();
		    		}
					
					//remark1Desc="";
				}else if(object.businessTypes=="5")
				{
					businessTypeDesc="农户小额信用贷款";
					$("#remark1Td").hide();
					$("#remark1Val").hide();
					$("#remark2Td").hide();
					$("#remark2Val").hide();
				}
				else {
					businessTypeDesc=object.businessTypes;
					$("#remark1Td").hide();
					$("#remark1Val").hide();
					$("#remark2Td").hide();
					$("#remark2Val").hide();
				}
			    
			    $("#businessTypes").html(businessTypeDesc);
			  
			    $("#remark1").html(remark1Desc);
			    
			    $("#remark2").html(remark2Desc);
			    $("#amount").html(object.amount);
				$("#term").html(object.term);
				var repaymentMethodDesc="";
				if(object.repaymentMethod=="1")
				{
					repaymentMethodDesc="等额本金";
					
				}else if(object.repaymentMethod=="2")
				{
					repaymentMethodDesc="等额本息";
				}
				else if(object.repaymentMethod=="3")
				{
					repaymentMethodDesc="循环用款";
				}
				else if(object.repaymentMethod=="4")
				{
					repaymentMethodDesc="到期还本";
				}
				else if(object.repaymentMethod=="5")
				{
					repaymentMethodDesc="分期还款";
				}
				else{
					repaymentMethodDesc=object.repaymentMethod;
				}
				$("#repaymentMethod").html(repaymentMethodDesc);
				
				$("#recieveTime").html(object.recieveTime);
				var guaranteeMethodDesc;
			    if(object.guaranteeMethod=="1")
				{
			    	guaranteeMethodDesc="信用";
				}
				else if(object.guaranteeMethod=="2")
				{
					guaranteeMethodDesc="保证";
				}else if(object.guaranteeMethod=="3")
				{
					guaranteeMethodDesc="抵押";
				}else if(object.guaranteeMethod=="4")
				{
					guaranteeMethodDesc="质押";
				}
				else {
					guaranteeMethodDesc=object.guaranteeMethod;
				}
				$("#guaranteeMethod").html(guaranteeMethodDesc);
				var isRenewDesc;
			    if(object.isRenew=="1")
				{
			    	isRenewDesc="新增";
				}
				else if(object.isRenew=="2")
				{
					isRenewDesc="续贷";
				}else if(object.isRenew=="3")
				{
					isRenewDesc="追加";
				}else if(object.isRenew=="4")
				{
					isRenewDesc="借新还旧";
				}
				else if(object.isRenew=="5")
				{
					isRenewDesc="展期";
				}
				else if(object.isRenew=="6")
				{
					isRenewDesc="重组贷款";
				}
				else {
					isRenewDesc=object.isRenew;
				}
				$("#isRenew").html(isRenewDesc);
				$("#marketer").html(object.marketer);
				var marketerPostDesc;
			    if(object.marketerPost=="1")
				{
			    	marketerPostDesc="白龙基社";
				}
				else if(object.marketerPost=="2")
				{
					marketerPostDesc="茨坝基社";
				}else if(object.marketerPost=="3")
				{
					marketerPostDesc="东华基社";
				}else if(object.marketerPost=="4")
				{
					marketerPostDesc="联盟基社";
				}
				else if(object.marketerPost=="5")
				{
					marketerPostDesc="龙泉基社";
				}
				else if(object.marketerPost=="6")
				{
					marketerPostDesc="龙头街基社";
				}
				else if(object.marketerPost=="7")
				{
					marketerPostDesc="营业部";
				}else if(object.marketerPost=="8")
				{
					marketerPostDesc="联社机关";
				}else if(object.marketerPost=="9")
				{
					marketerPostDesc="小微金融服务中心";
				}
				else if(object.marketerPost=="10")
				{
					marketerPostDesc="个金部营销组";
				}
				else if(object.marketerPost=="11")
				{
					marketerPostDesc="个金部管护组";
				}
				else if(object.marketerPost=="12")
				{
					marketerPostDesc="个金部一手房组";
				}
				else if(object.marketerPost=="13")
				{
					marketerPostDesc="个金部二手房组";
				}
				else if(object.marketerPost=="14")
				{
					marketerPostDesc="个金部不良组";
				}
				else if(object.marketerPost=="15")
				{
					marketerPostDesc="个金部部门员工";
				}
				else if(object.marketerPost=="16")
				{
					marketerPostDesc="金江分社员工";
				}
				else {
					marketerPostDesc=object.marketerPost;
				}
				$("#marketerPost").html(marketerPostDesc);
				$("#operator").html(object.operator);
				var operatorPostDesc;
			    if(object.operatorPost=="1")
				{
			    	operatorPostDesc="白龙基社";
				}
			    else if(object.operatorPost=="2")
				{
			    	operatorPostDesc="茨坝基社";
				}else if(object.operatorPost=="3")
				{
					operatorPostDesc="东华基社";
				}else if(object.operatorPost=="4")
				{
					operatorPostDesc="联盟基社";
				}
				else if(object.operatorPost=="5")
				{
					operatorPostDesc="龙泉基社";
				}
				else if(object.operatorPost=="6")
				{
					operatorPostDesc="龙头街基社";
				}
				else if(object.operatorPost=="7")
				{
					operatorPostDesc="营业部";
				}else if(object.operatorPost=="8")
				{
					operatorPostDesc="联社机关";
				}else if(object.operatorPost=="9")
				{
					operatorPostDesc="小微金融服务中心";
				}
				else if(object.operatorPost=="10")
				{
					operatorPostDesc="个金部营销组";
				}
				else if(object.operatorPost=="11")
				{
					operatorPostDesc="个金部管护组";
				}
				else if(object.operatorPost=="12")
				{
					operatorPostDesc="个金部一手房组";
				}
				else if(object.operatorPost=="13")
				{
					operatorPostDesc="个金部二手房组";
				}
				else if(object.operatorPost=="14")
				{
					operatorPostDesc="个金部不良组";
				}
				else if(object.operatorPost=="15")
				{
					operatorPostDesc="个金部部门员工";
				}
				else if(object.operatorPost=="16")
				{
					operatorPostDesc="金江分社员工";
				}
				else {
					operatorPostDesc=object.operatorPost;
				}
				$("#operatorPost").html(operatorPostDesc);
				//将findById的值插入到全局变量中
				oldLoanInfo=object;
				
			}
			else
				{
					util.sysAlert(obj.data);
				}
		
		}
	});
};
/*
 * 获取url参数
 */
var getUrlParam=function(name) {
	 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	 var urlParam = window.location.search.substr(1);
	 var r = decodeURI(urlParam).match(reg);  //匹配目标参数
	 if (r != null) return unescape(r[2]); return null; //返回参数值

};

$(function(){
	var loanId = getUrlParam('loanId');
	loadsoftDetInfo(loanId);
	
	/*$("#dbrcl1").change(function(){
		if($(this).prop('checked')){
			
		}
	});*/
	
});

function changeState(el) {
    if (el.readOnly) el.checked=el.readOnly=false;
    else if (!el.checked) el.readOnly=el.indeterminate=true;
}


$("#returnBtn").click(function(){
	window.location.href = "./loanAppExamine.html";
});

/*$("#addBtn").click(function(){
	nowOperate = "add";
	$("#addFirmNum").attr("disabled",false);
	$("#action").html('新增贷款申请');
	showModel();
});*/

/**
 * 显示模态框
 */
var  showRefuseModel = function(){
	resetFormForm('refuseForm');
	$("#refuseModal").modal("show");
//	AddOrEditCheck();
};
var  showResubmitModel = function(){
	resetFormForm('resubmitForm');
	$("#resubmitModal").modal("show");
	//查询材料信息
	var loanId = getUrlParam('loanId');
	fillClForm(loanId);
};
var  showReviewModel = function(){
	resetFormForm('reviewForm');
	$("#reviewModal").modal("show");
	var loanId = getUrlParam('loanId');
	fillReviewForm(loanId);
};
/**
 * 清空form
 */
var resetFormForm = function(formId){
	$("#"+formId)[0].reset();
	$('span[id="errormsg"]').remove();
};

function fillReviewForm(loanId){
	util.emmAjax({
		url : querDetialUrl,
		type : 'post',
		data : {
			'loanId' : loanId
		},
		cache : false,
		dataType : 'text',
		success : function(data) {
			var obj = util.str2Json(data); 
			if(obj.success=='true')
			{
				var object = util.str2Json(data).data.loanInfo;
				$("#examineAmount").val(object.amount);
				$("#examineTerm").val(object.term);
				$("#examineGuaranteeMethod").val(object.guaranteeMethod);
				$("#examineRepaymentMethod").val(object.repaymentMethod);
			}
			else
				{
					util.sysAlert(obj.data);
				}
		}
	});
}

//填入材料信息
function fillClForm(loanId){
	var busType=oldLoanInfo.businessTypes;
	util.emmAjax({
		url : querClUrl,
		type : 'post',
		data : {
			'businessType':busType,
			'loanSubType':subBusinessType
		},
		cache : false,
		dataType : 'text',
		success : function(data) {
			var obj = util.str2Json(data); 
			if(obj.success=='true')
			{
				var object = util.str2Json(data).data;
				//alert(object);
				var jkr=util.str2Json(object.borrowerDetail);
				var jkrclHtml='';
				if(jkr!=null&&jkr.length>0)
				{
					jkrclHtml+='<div class="col-sm-12"><label for="name">借款人所需材料</label></div><div class="form-group" >';
					for(var i=0;i<jkr.length;i++)
					{
						jkrclHtml+='<div class="checkbox checkbox-danger">'+
									'<input id="jkrcl'+i+'" type="checkbox" class="styled" name="jkr" value="'+jkr[i]+'">'+
									'<label for="jkrcl'+i+'">'+jkr[i]+'</label></div>';
					}
					jkrclHtml+='</div>';
				}	
				$("#jkrcl").html(jkrclHtml);
				
				var dbr=util.str2Json(object.guarantorDetail);
				var dbrclHtml='';
				if(dbr!=null&&dbr.length>0)
				{
					dbrclHtml+='<div class="col-sm-12"><label for="name">担保人所需材料</label></div><div class="form-group" >';
					for(var i=0;i<dbr.length;i++)
					{
						dbrclHtml+='<div class="checkbox checkbox-danger">'+
									'<input id="dbrcl'+i+'" type="checkbox" class="styled" name="dbr" value="'+dbr[i]+'">'+
									'<label for="dbrcl'+i+'">'+dbr[i]+'</label></div>';
					}
					dbrclHtml+='</div>';
				}	
				$("#dbrcl").html(dbrclHtml);
				
				var qt=util.str2Json(object.otherDetail);
				var qtclHtml='';
				if(qt!=null&&qt.length>0)
				{
					qtclHtml+='<div class="col-sm-12"><label for="name">其他所需材料</label></div><div class="form-group" >';
					for(var i=0;i<qt.length;i++)
					{
						qtclHtml+='<div class="checkbox checkbox-danger">'+
									'<input id="qtcl'+i+'" type="checkbox" class="styled" name="qt" value="'+qt[i]+'">'+
									'<label for="qtcl'+i+'">'+qt[i]+'</label></div>';
					}
					qtclHtml+='</div>';
				}	
				$("#qtcl").html(qtclHtml);
				//$("#examineAmount").val(object.amount);
				//$("#examineTerm").val(object.term);
				//$("#examineGuaranteeMethod").val(object.guaranteeMethod);
				//$("#examineRepaymentMethod").val(object.repaymentMethod);
			}
			else
				{
					util.sysAlert(obj.data);
				}
		}
	});
}


function approve(result){
	
	var processUser = getUrlParam('loginUserName');
	if(result=="REFUSE")
	{
		//退件
		var approveOpinion=$("#remove_opinion").val();
		if(approveOpinion=="")
		{
			//util.sysAlert("审查意见不能为空！");
			util.sysTips("审查意见不能为空！ ","remove_opinion");
		}
		else
		{
			/*var params =getParam();
			params=params+('\"loanInfo.examineAmount\":\"'+examineAmount+ '\",');
			params=params+('\"loanInfo.examineTerm\":\"'+examineTerm+ '\",');
			params=params+('\"loanInfo.examineGuaranteeMethod\":\"'+examineGuaranteeMethod+ '\",');
			params=params+('\"loanInfo.examineRate\":\"'+examineRate+ '\",');
			params=params+('\"loanInfo.examineRepaymentMethod\":\"'+examineRepaymentMethod+ '\"');
			params += '}';
			params=str2Json(params);*/
			var id = getUrlParam('loanId');
			util.confirmView(function(){
				util.emmAjax({
					url : '../loan/loanRefuse.action',
					type : 'post',
					data : {
						'loanId':id,
						'curProcessFeedback':approveOpinion,
						'curProcessUser':processUser
					},
					cache : false,
					dataType : 'text',
					success : function(data) {
						var obj =str2Json(data);
						if(obj.success=='true')
						{
							util.sysAlert("审查完成");
							window.location.href = "./loanAppExamine.html";
						}
						else{
							util.sysAlert(obj.data);
						}
					}
				});
			},"确定提交吗?");
		}
	}else if(result=="RESUBMIT")
	{
		//补件
		//获取材料多选框的值 
		
		var jkrIndex=0;
		var dbrIndex=0;
		var qtIndex=0;
		var strjkr= new Array();
		$("[name='jkr']").each(function(){
			if($(this).prop('checked'))
			{
				strjkr[jkrIndex]=$(this).val();
				jkrIndex++;
			}
		})
		
		var strdbr= new Array();
		$("[name='dbr']").each(function(){
			if($(this).prop('checked'))
			{
				strdbr[dbrIndex]=$(this).val();
				dbrIndex++;
			}
		}) 
		
		var strqt= new Array();
		$("[name='qt']").each(function(){
			if($(this).prop('checked'))
			{
				strqt[qtIndex]=$(this).val();
				qtIndex++;
			}
		}) 
		//alert(str); 
		
		var resubmitOpinion=$("#resubmit_opinion").val();
		
		if(strjkr.length==0&&strdbr.length==0&&strqt.length==0)
		{
			util.sysAlert("请勾选需要补件的材料！");
		}
		/*else if(resubmitOpinion=="")
		{
			util.sysTips("补件意见不能为空！ ","resubmit_opinion");
		}*/
		else
		{
			var params =getParam();
			for(var i=0;i<strjkr.length;i++)
			{
				params=params+('\"loanInfo.jkrqscl['+i+']\":\"'+strjkr[i]+ '\",');
			}
			for(var i=0;i<strdbr.length;i++)
			{
				params=params+('\"loanInfo.dbrqscl['+i+']\":\"'+strdbr[i]+ '\",');
			}
			for(var i=0;i<strqt.length;i++)
			{
				params=params+('\"loanInfo.qtqscl['+i+']\":\"'+strqt[i]+ '\",');
			}
			params=params+('\"loanInfo.qtbc\":\"'+resubmitOpinion+ '\",');
			params = params.substring(0, params.length - 1);
			params += '}';
			params=str2Json(params);
			
			var id = getUrlParam('loanId');
			util.confirmView(function(){
				util.emmAjax({
					url : '../loan/loanJournalResubmit.action',
					type : 'post',
					data : params,
					cache : false,
					dataType : 'text',
					success : function(data) {
						var obj =str2Json(data);
						if(obj.success=='true')
						{
							util.sysAlert("审查完成");
							window.location.href = "./loanAppExamine.html";
						}
						else{
							util.sysAlert(obj.data);
						}
					}
				});
			},"确定提交吗?");
		}
	}else if(result=="REVIEW")
	{
		//审核
		var examineAmount=$("#examineAmount").val();
		var examineTerm=$("#examineTerm").val();
		var examineGuaranteeMethod=$("#examineGuaranteeMethod").val();
		var examineRate=$("#examineRate").val();
		var examineRepaymentMethod=$("#examineRepaymentMethod").val();
		if(examineAmount=="")
		{
			util.sysTips("申贷金额不能为空！ ","examineAmount");
		}
		else if(examineTerm=="")
		{
			util.sysTips("申贷期限不能为空！ ","examineTerm");
		}
		if(examineRate=="")
		{
			util.sysTips("利率不能为空！ ","examineRate");
		}
		else if(examineGuaranteeMethod=="0")
		{
			util.sysTips("请选择担保方式！ ","examineGuaranteeMethod");
		}
		else if(examineRepaymentMethod=="0")
		{
			util.sysTips("请选择还款方式！ ","examineRepaymentMethod");
		}
		else
		{
			var id = getUrlParam('loanId');
			var params =getParam();
			params=params+('\"loanInfo.examineAmount\":\"'+examineAmount+ '\",');
			params=params+('\"loanInfo.examineTerm\":\"'+examineTerm+ '\",');
			params=params+('\"loanInfo.examineGuaranteeMethod\":\"'+examineGuaranteeMethod+ '\",');
			params=params+('\"loanInfo.examineRate\":\"'+examineRate+ '\",');
			params=params+('\"loanInfo.examineRepaymentMethod\":\"'+examineRepaymentMethod+ '\"');
			params += '}';
			params=str2Json(params);
			util.confirmView(function(){
				util.emmAjax({
					url : '../loan/loanReviewSuccess.action',
					type : 'post',
					data : params,
					/*{
						'loanId':id,
						'curProcessFeedback':approveOpinion,
						'curProcessUser':processUser,
						'examineAmount':examineAmount,
						'examineTerm':examineTerm,
						'examineGuaranteeMethod':examineGuaranteeMethod,
						'examineRate':examineRate,
						'examineRepaymentMethod':examineRepaymentMethod
					},*/
					cache : false,
					dataType : 'text',
					success : function(data) {
						var obj =str2Json(data);
						if(obj.success=='true')
						{
							util.sysAlert("审查完成");
							window.location.href = "./loanAppExamine.html";
						}
						else{
							util.sysAlert(obj.data);
						}
					}
				});
			},"确定提交吗?");
		}
		
	}
	
}

/**
 * 获得编辑的参数
 * @return
 */
var getParam = function(){
	
	var loanId = getUrlParam('loanId');
	var loginUserName = getUrlParam('loginUserName');
	var param='{';
	param=param+('\"loanId\":\"'+loanId+ '\",');
	//param=param+('\"operator\":\"'+loginUserName+ '\",');
	//param=param+('\"orgId\":\"'+orgId+ '\",');
	//param=param+('\"LoanAmount\":\"'+addAmount+ '\",');
	//param=param+('\"LoanTerm\":\"'+addTerm+ '\",');
	//param=param+('\"pickupTime\":\"'+addRecieveTime+ '\",');
	param=param+('\"loanInfo.borrowerName\":\"'+oldLoanInfo.borrowerName+ '\",');
	param=param+('\"loanInfo.isMaryed\":\"'+oldLoanInfo.isMaryed+ '\",');
	if(oldLoanInfo.isMaryed=="是")
	{
		param=param+('\"loanInfo.spouseName\":\"'+oldLoanInfo.spouseName+ '\",');
		param=param+('\"loanInfo.spouseCredentialNo\":\"'+oldLoanInfo.spouseCredentialNo+ '\",');
	}
	param=param+('\"loanInfo.sex\":\"'+oldLoanInfo.sex+ '\",');
	param=param+('\"loanInfo.credentialNo\":\"'+oldLoanInfo.credentialNo+ '\",');
	var addBusinessTypes=oldLoanInfo.businessTypes;
	param=param+('\"loanInfo.businessTypes\":\"'+addBusinessTypes+ '\",');

	if(addBusinessTypes=='1')
	{
		param=param+('\"loanInfo.ysfRemark1\":\"'+oldLoanInfo.ysfRemark1+ '\",');
		if(oldLoanInfo.ysfRemark1=='1')
		{
			param=param+('\"loanInfo.yszfRemark2\":\"'+oldLoanInfo.yszfRemark2+ '\",');
		}
		else if(oldLoanInfo.ysfRemark1=='2')
		{
			param=param+('\"loanInfo.syfRemark2\":\"'+oldLoanInfo.syfRemark2+ '\",');
		}
		var addArea=$("#addArea").val();
		var addHouseAmount=$("#addHouseAmount").val();
		
		var addIncome=$("#addIncome").val();
		var addPayPerMonth=$("#addPayPerMonth").val();
		param=param+('\"loanInfo.area\":\"'+addArea+ '\",');
		param=param+('\"loanInfo.houseAmount\":\"'+addHouseAmount+ '\",');
		
		param=param+('\"loanInfo.income\":\"'+addIncome+ '\",');
		param=param+('\"loanInfo.payPerMonth\":\"'+addPayPerMonth+ '\",');
		//如果备注2不是车位，需要上传第几套房的值
		if(oldLoanInfo.syfRemark2!='1')
		{
			var addHouseNum=$("#addHouseNum").val();
			param=param+('\"loanInfo.houseNum\":\"'+addHouseNum+ '\",');
			
		}
		
		
	}
	else if(addBusinessTypes=='2')
	{
		param=param+('\"loanInfo.esfRemark\":\"'+oldLoanInfo.esfRemark+ '\",');
		var addArea=$("#addArea").val();
		var addHouseAmount=$("#addHouseAmount").val();
		var addHouseNum=$("#addHouseNum").val();
		var addIncome=$("#addIncome").val();
		var addPayPerMonth=$("#addPayPerMonth").val();
		param=param+('\"loanInfo.area\":\"'+addArea+ '\",');
		param=param+('\"loanInfo.houseAmount\":\"'+addHouseAmount+ '\",');
		param=param+('\"loanInfo.houseNum\":\"'+addHouseNum+ '\",');
		param=param+('\"loanInfo.income\":\"'+addIncome+ '\",');
		param=param+('\"loanInfo.payPerMonth\":\"'+addPayPerMonth+ '\",');
	
	}else if(addBusinessTypes=='3')
	{
		param=param+('\"loanInfo.xfdkRemark\":\"'+oldLoanInfo.xfdkRemark+ '\",');
		
	
	}else if(addBusinessTypes=='4')
	{
		param=param+('\"loanInfo.jydkRemark1\":\"'+oldLoanInfo.jydkRemark1+ '\",');
		if(oldLoanInfo.jydkRemark1=='2')
		{
			param=param+('\"loanInfo.syryRemark2\":\"'+oldLoanInfo.syryRemark2+ '\",');
		}
		else if(oldLoanInfo.jydkRemark1=='3')
		{
			param=param+('\"loanInfo.dmfbRemark2\":\"'+oldLoanInfo.dmfbRemark2+ '\",');
		}
	
	}else if(addBusinessTypes=='5')
	{
		
	}
	param=param+('\"loanInfo.amount\":\"'+oldLoanInfo.amount+ '\",');
	param=param+('\"loanInfo.term\":\"'+oldLoanInfo.term+ '\",');
	param=param+('\"loanInfo.guaranteeMethod\":\"'+oldLoanInfo.guaranteeMethod+ '\",');
	param=param+('\"loanInfo.repaymentMethod\":\"'+oldLoanInfo.repaymentMethod+ '\",');
	param=param+('\"loanInfo.recieveTime\":\"'+oldLoanInfo.recieveTime+ '\",');
	param=param+('\"loanInfo.isRenew\":\"'+oldLoanInfo.isRenew+ '\",');
	param=param+('\"loanInfo.marketer\":\"'+oldLoanInfo.marketer+ '\",');
	param=param+('\"loanInfo.marketerPost\":\"'+oldLoanInfo.marketerPost+ '\",');
	param=param+('\"loanInfo.operator\":\"'+oldLoanInfo.operator+ '\",');
	param=param+('\"loanInfo.operatorPost\":\"'+oldLoanInfo.operatorPost+ '\",');
	//param += '}';
	//param=str2Json(param);
	return param;
};

/**
 *将json字符串转化为json对象
 */
function str2Json(jsonStr){
	var json = eval("(" + jsonStr + ")"); 
	return json;
};